//
//  AwardCardVC.m
//  SelfDriving
//
//  Created by apple on 16/1/17.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "AwardCardVC.h"

@interface AwardCardVC ()<UITableViewDelegate,UITableViewDataSource,UIWebViewDelegate>

@end

@implementation AwardCardVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 3;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    if (section!=0) {
        return  8;
    }
    return 0;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section !=0) {
        return 180;
    }else{
        return 168;
    }
    return 0;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 0) {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell1"];
        cell.backgroundColor = colorBG;
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        return cell;
    }
    if (indexPath.section == 1) {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell1"];
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell2"];
        UIWebView *web = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, SCRE_WIDTH, 200)];
        NSString *documentLocation =  [[NSBundle mainBundle]  pathForResource:@"networkshare_q" ofType:@"html"];
        NSURL *myDocument = [NSURL fileURLWithPath:documentLocation];
        NSURLRequest *request = [NSURLRequest requestWithURL:myDocument];
        web.backgroundColor = [UIColor clearColor];
        web.delegate = self;
        [web loadRequest:request];
        web.scrollView.scrollEnabled = NO;
        [cell.contentView addSubview:web];
        
        return cell;
        
    }
    if (indexPath.section == 2) {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell1"];
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell2"];
        UIWebView *web = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, SCRE_WIDTH, 200)];
        NSString *documentLocation =  [[NSBundle mainBundle]  pathForResource:@"networkshare_q" ofType:@"html"];
        NSURL *myDocument = [NSURL fileURLWithPath:documentLocation];
        NSURLRequest *request = [NSURLRequest requestWithURL:myDocument];
        web.backgroundColor = [UIColor clearColor];
        web.delegate = self;
        web.scrollView.scrollEnabled = NO;
        [web loadRequest:request];
        [cell.contentView addSubview:web];
        
        return cell;
        
    }
    return nil;
    
}
-(void)webViewDidFinishLoad:(UIWebView *)webView{
    
    //    NSString *tete = [NSString stringWithFormat:@"show(\"%@\",\"%@\");",xy,@"参与人数"];
    //    [webView stringByEvaluatingJavaScriptFromString:tete];
    
}
- (IBAction)backActino:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}


@end
